package org.xjtu.weteam.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import org.xjtu.weteam.model.domain.User;
import org.xjtu.weteam.model.domain.Team;
import org.xjtu.weteam.model.domain.UserTeam;

import java.util.List;

/**
 * @author Kevin
 */

@Mapper
public interface UserTeamMapper extends BaseMapper<UserTeam> {
    List<User> selectAllUsers(Integer teamid);
    @Delete("delete from user_team where user_id = #{userId} and team_id = #{teamId}")
    void removeRelationship(@Param("userId") Integer userId, @Param("teamId") Integer teamId);

    List<UserTeam> checkIfIn(@Param("teamId") Integer teamId,@Param("userId") Integer userId);
    @Update("update user_team set role='130'  where team_id=#{teamId} and user_id=#{userId};")
    void updateCreator(@Param("teamId") Integer teamId, @Param("userId") Integer userId);
}
